var darkPid, brightPid: integer; macro '[i]import full size photometrics image'; var origPid: integer; begin SaveState; SetImport('8-bits,Custom'); SetCustom(2634,1034,2124); Import(''); origPid := pidNumber; {MakeNewWindow will not make odd width windows.} {Therefore, 16 bit images must be even # pixels wide} {or width multiple of 4} SetNewSize(2632,1032); MakeRoi(0, 2, 2632,1032); Copy; MakeNewWindow(GetPicName); Paste; ChoosePic(origPid); Dispose; RestoreState; end; macro 'import full size photometrics images into stack'; var stkPid, origPid, i: integer; begin SaveState; SetNewSize(2632,1032); MakeNewStack('imported'); RestoreState; stkPid := pidNumber; i := 0; while true do begin i := i + 1; SaveState; SetImport('8-bits,Custom'); SetCustom(2634,1034,2124); Import('always dialog'); RestoreState; origPid := pidNumber; {MakeNewWindow will not make odd width windows.} {Therefore, 16 bit images must be even # pixels wide} {or width multiple of 4} MakeRoi(0, 2, 2632,1032); Copy; ChoosePic(stkPid); if i > nSlices then addSlice; chooseSlice(i); Paste; ChoosePic(origPid); Dispose; end; end; macro 'fix full size photometrics'; var origPid: integer; begin SaveState; origPid := pidNumber; {MakeNewWindow will not make odd width windows.} {Therefore, 16 bit images must be even # pixels wide} {or width multiple of 4} SetNewSize(2632,1032); MakeRoi(0, 2, 2632,1032); Copy; MakeNewWindow(GetPicName); Paste; SelectPic(origPid); SetPicName('delete me ',GetPicName); RestoreState; end; macro 'set x lookup table'; var pWidth: integer; begin pWidth := 999; rUser1[1] := 1/1.0*pWidth; rUser1[2] := 1/1.000*pWidth; rUser1[3] := 1/1.000*pWidth; rUser1[4] := 1/1.533*pWidth; rUser1[5] := 1/2.357*pWidth; rUser1[6] := 1/2.994*pWidth; rUser1[7] := 1/3.949*pWidth; rUser1[8] := 1/6.669*pWidth; rUser1[9] := 0; end; macro 'plot time series'; var x,y, xx, yy, v1, v2, x1, x2: integer; left, top, width, height: integer; i, n, inPid, plotPid: integer; miny, maxy, pWidth, pHeight: integer; begin inPid := pidNumber; SaveState; pWidth := 999; pHeight := 799; SetNewSize(pWidth + 1, pHeight + 1); MakeNewWindow('plot time series'); plotPid := pidNumber; RestoreState; ChoosePic(inPid); GetRoi(left, top, width, height); left := left div 2; width := width div 2; n := nSlices; miny := GetNumber('min y',0); maxy := GetNumber('max y', pHeight); for yy := top to top + height - 1 do begin y := top + random * (height - 1); for xx := left to left + width - 1 do begin x := left + random * (width - 1); {v2 := pHeight;} {x2 := 0;} x2 := rUser1[1]; ChoosePic(inPid); ChooseSlice(1); v2 := pHeight - (getPixel16u(inPid, x, y) - miny) * pHeight div maxy; for i := 2 to n do begin ChoosePic(inPid); ChooseSlice(i); x1 := x2; {x2 := (i-1) * pWidth div n;} x2 := rUser1[i]; v1 := v2; v2 := pHeight - (getPixel16u(inPid, x, y) - miny) * pHeight div maxy; {showMessage(x, y, getPixel16u(inPid, x, y));} if v2 < 0 then v2 := 0; if v2 > pHeight then v2 := pHeight; ChoosePic(plotPid); MoveTo(x1,v1); LineTo(x2,v2); end; end; end; end; macro 'front image is dark'; begin darkPid := pidNumber; end; macro 'front image is bright'; begin brightPid:= pidNumber; end; macro 'flat field correction'; var inPid, denom, outPid: integer; width, height: integer; begin inPid:= PidNumber; GetPicSize(width, height); SetNewSize(width, height); MakeNewWindow(getPicName,'.flat'); outPid := PidNumber; sub16u(inPid, darkPid, outPid); MakeNewWindow('bright - dark'); denom := pidNumber; sub16u(brightPid, darkPid, denom); ratio16u(outPid, denom, outPid,32768); choosePic(denom); dispose; end;